package com.jason.serivce.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils;

import com.jason.bean.UserInfo;
import com.jason.dao.UserInfoDao;
import com.jason.service.UserInfoService;

@Service("userInfoService")
public class UserInfoServiceImpl implements UserInfoService {
	@Resource
	private UserInfoDao userInfoDao;

	@Override
	public UserInfo login(UserInfo user) {
		String password = DigestUtils
				.md5DigestAsHex((user.getAccount() + user.getPassword()).getBytes());
		user.setPassword(password);
		UserInfo info = userInfoDao.findByAccountAndPassword(user.getAccount(), user.getPassword());
		return info;
	}
}
